package com.cip.admin.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;

import com.cip.admin.dao.InstituteDAO;
import com.cip.admin.model.Institute;

public class InstituteDAOImpl extends CipHibernateDAOSupport implements InstituteDAO{

	public List<Institute> getAllInsList() throws Exception {
		HibernateTemplate hibernateTemplate = getCipHibernateTemplate();		
	    List<Institute> instList = hibernateTemplate.loadAll(Institute.class);
		return instList;
	}

	public Institute getInstituteById(int id) throws Exception {
		HibernateTemplate hibernateTemplate = getHibernateTemplate();
		 return hibernateTemplate.get(Institute.class, id);
	}

	public Institute saveOrUpdateInstitute(Institute institute) throws Exception {
		getHibernateTemplate().saveOrUpdate(institute);
		return institute;
	}

	public Institute editInstitute(Institute institute) throws Exception {
		getHibernateTemplate().update(institute); 
		return institute;
	}

}
